console.log('-------------- search -----------------')
const helper = new Helper(this);
// 搜索框
const communicationName = __artemis__tree.getSearchText();
// 融合通讯列表
const organizationWidgetObj = helper.get('tree_organization')?.widgetObj;

function renderOrgTree (result) {
    __artemis__tree.renderTree(result, (dataSource) => {
        if (organizationWidgetObj) {
            organizationWidgetObj._option.dataSource = dataSource;
            organizationWidgetObj.render();
        }
    })
}

if (__artemis__tabs.tabCheckedNum === 3) {
    __artemis__tree.loadAccountListData({ communicationName }).then(result => {
        if (Array.isArray(result)) renderOrgTree(result)
    });
} else {
    if (__artemis__tabs.tabCheckedNum === 1) {
        __artemis__tree.loadOrgListData({ communicationName }).then(result => {
            if (Array.isArray(result)) renderOrgTree(result)
        });
    } else if (__artemis__tabs.tabCheckedNum === 2) {
        __artemis__tree.loadGroupListData({ communicationName }).then(result => {
            if (Array.isArray(result)) renderOrgTree(result)
        });
    }
}
